import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '大类名称',
    align: "center",
    dataIndex: 'bigTypeName'
  },
  {
    title: '类别名称',
    align: "center",
    dataIndex: 'midTypeName'
  },
  {
    title: '实验项目名称',
    align: "center",
    dataIndex: 'itemName'
  },
  {
    title: '依据的标准名称',
    align: "center",
    dataIndex: 'basisName'
  },
  {
    title: '依据的标准编号',
    align: "center",
    dataIndex: 'basisNum'
  },
  // {
  //   title: '限制范围',
  //   align: "center",
  //   dataIndex: 'basisScope'
  // },
  {
    title: '依据附件',
    align: "center",
    dataIndex: 'basisAtta',
    width:130,
    slots: { customRender: 'fileSlot' },
  },

  // {
  //   title: '班组',
  //   align: "center",
  //   dataIndex: 'team'
  // },
  {
    title: '实验人员',
    align: "center",
    dataIndex: 'testPerson',
    width:130
  },
  {
    title: '项目状态',
    align: "center",
    dataIndex: 'itemStatus',
    width:130
  },
  {
    title: '完成时间',
    align: "center",
    dataIndex: 'itemFinishTime',
    width:130
  },
  {
    title: '委托单ID',
    align: "center",
    dataIndex: 'entrustId',
    width:180,
    ifShow:false,
  },
  // {
  //   title: '备注',
  //   align: "center",
  //   dataIndex: 'remark',
  //   width:130
  // },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "实验项目名称",
    field: 'itemName',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "实验人员",
    field: 'testPerson',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "项目状态",
    field: 'itemStatus',
    component: 'Input',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '实验项目名称',
    field: 'itemName',
    component: 'Input',
  },
  {
    label: '依据的标准名称',
    field: 'basisName',
    component: 'Input',
  },
  {
    label: '依据的标准编号',
    field: 'basisNum',
    component: 'Input',
  },
  {
    label: '限制范围',
    field: 'basisScope',
    component: 'Input',
  },
  {
    label: '依据附件',
    field: 'basisAtta',
    component: 'Input',
  },
  {
    label: '大类名称',
    field: 'bigTypeName',
    component: 'Input',
  },
  {
    label: '类别名称',
    field: 'midTypeName',
    component: 'Input',
  },
  {
    label: '班组',
    field: 'team',
    component: 'Input',
  },
  {
    label: '实验人员',
    field: 'testPerson',
    component: 'Input',
  },
  {
    label: '项目状态',
    field: 'itemStatus',
    component: 'Input',
  },
  // {
  //   label: '发布时间',
  //   field: 'pubDate',
  //   component: 'Input',
  // },
  {
    label: '完成时间',
    field: 'itemFinishTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];


//子表表格配置
export const labSampleColumns: BasicColumn[] = [
  {
   title: '样品名称',
   align:"center",
   dataIndex: 'samName'
  },
  {
   title: '规格型号',
   align:"center",
   dataIndex: 'model'
  },
  {
   title: '产品批号',
   align:"center",
   dataIndex: 'lotNum'
  },
  {
   title: '取样日期',
   align:"center",
   dataIndex: 'samDate',
   customRender:({text}) =>{
     return !text?"":(text.length>10?text.substr(0,10):text)
   },
  },
  {
   title: '样品量 (g/kg/mL/L)',
   align:"center",
   dataIndex: 'samQuality'
  },
  {
   title: '样品外观',
   align:"center",
   dataIndex: 'samAppear'
  },
 //  {
 //   title: '其他说明',
 //   align:"center",
 //   dataIndex: 'remark'
 //  },
  {
   title: '样品编号',
   align:"center",
   dataIndex: 'samNum'
  },
  {
   title: '操作',
   align:"center",
   dataIndex: 'operation',
   key: 'operation',
 },
  {
   title: '委托主键ID',
   align:"center",
   dataIndex: 'entrustId',
   ifShow:false
  },
];
